import {$http} from "@/utils/request/requestConfig.js"

const api = {
	"category":"api/route/category/list",
	"routes":"api/route/list",
	"make":"api/route",
	"detail":"api/route/{routeId}",
	"delete":"api/route/{routeId}",
	"update":"api/route"
}

export const routesList = (data) => {
	return $http.get(api.routes,data)
}

export const categoryList = () => {
	return $http.get(api.category)
}

export const makeRoute = (data) =>{
	return $http.post(api.make,data)
}

export const routeDetail = (data) =>{
	const detail = api.detail.replace(/{routeId}/,data)
	return $http.get(detail)
}

export const deleteRoute = (data) =>{
	const detail = api.detail.replace(/{routeId}/,data)
	return $http.delete(detail,data)
}

export const updateRoute = (data) =>{
	return $http.put(api.update,data)
}
